# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Xeonacid <h.dwwwwww at gmail dot com>

_pyname=itanium_demangler
pkgname=python-${_pyname/_/-}
pkgver=1.1
pkgrel=2
pkgdesc='Pure Python Itanium C++ ABI demangler'
url='https://github.com/whitequark/python-itanium_demangler'
arch=('any')
license=('custom:0BSD')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-setuptools')
checkdepends=('python-pytest')
provides=('python-itanium_demangler')
source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('6b80ce845d0162d4f9b7a657aeef6a4b4d63362849e0e7795369567472432e3b0e110d9294c2a61a8f36911f3a493ead91c1a73baae676f1f4ac8a9affba6ca8')
b2sums=('bfc9b578e22ea57984f3d0d6e5d07517ce6ed3c790dabf24e9d49b02a3a88ff4d7927bc273004e7ecf899c4ba670787c80265b923c5ac9e7cf6320f52536263f')

build() {
  cd python-${_pyname}-${pkgver}
  python -m build --wheel --no-isolation
}

check() {
  cd python-${_pyname}-${pkgver}
  export PYTHONPATH="${PWD}/build/lib"
  python -m unittest discover tests
}

package() {
  cd python-${_pyname}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE-0BSD.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
